package com.wing.production.feign;


import com.wing.common.utils.JsonResult;
import com.wing.common.utils.PageResult;
import com.wing.production.workOrder.entity.ProProfession;
import com.wing.production.workOrder.entity.ProductionProcessMaterial;
import com.wing.production.workOrder.entity.SimpleWorkOrder;
import com.wing.production.workOrder.request.SimpleWorkOrderForm;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

@FeignClient(name = "${production.appName}", fallback = ProductionClientFallback.class)
public interface ProductionClient {
    @GetMapping("/productionPlan/admin/productionProcessMaterial/getMaterial")
    JsonResult<ProductionProcessMaterial> getMaterial(@RequestParam("simpleWorkOrderId") Long simpleWorkOrderId, @RequestParam("skuCode") String skuCode);

    /**
     * 查询工单
     *
     * @return
     */
    @GetMapping("/productionPlan/admin/simpleWorkOrder/list")
    PageResult<SimpleWorkOrder> getSimpleWorkOrderPageList(
            @RequestParam("page") Integer page
            , @RequestParam("limit") Integer limit
            , @RequestParam(value = "sort", defaultValue = "create_time") String sort
            , @RequestParam(value = "order", defaultValue = "asc") String order
            , @RequestParam(value = "code") String code
            , @RequestParam(value = "skuCode") String skuCode
            , @RequestParam(value = "startTime") String startTime
            , @RequestParam(value = "endTime") String endTime);

    /**
     * 添加工单
     *
     * @param simpleWorkOrderForm
     * @return
     */
    @PostMapping("/productionPlan/admin/simpleWorkOrder/addSimpleWorkOrder")
    JsonResult addSimpleWorkOrder(@RequestBody SimpleWorkOrderForm simpleWorkOrderForm);

    @GetMapping("/productionPlan/admin/profession/getAllProfession")
    JsonResult<List<ProProfession>> getAllProfession();
    
    @GetMapping("/productionPlan/admin/profession/listByName")
    JsonResult<List<ProProfession>> listProfession(@RequestParam(value = "professionName") String professionName);

}
